import { _decorator, Component, Node } from 'cc';
import { UIManager } from '../common/UIManager';
import { PrefabEnum } from '../common/PrefabEnum';
const { ccclass, property } = _decorator;

@ccclass('MenuLayout')
export class MenuLayout extends Component {
    @property(Node)
    art:Node
    @property(Node)
    copy:Node
    @property(Node)
    report:Node
    @property(Node)
    rank:Node
    @property(Node)
    heroFight:Node
    @property(Node)
    palace:Node
    @property(Node)
    heroYar:Node
    @property(Node)
    army:Node
    @property(Node)
    pass:Node
    @property(Node)
    union:Node
    @property(Node)
    develop:Node
    @property(Node)
    transport:Node

    start() {
        this.node.on(Node.EventType.TOUCH_END, this.onClose, this)

        this.art.on(Node.EventType.TOUCH_END, this.onArt, this)
        this.copy.on(Node.EventType.TOUCH_END, this.onCopy, this)
        this.heroFight.on(Node.EventType.TOUCH_END, this.onHeroFight, this)
        this.heroYar.on(Node.EventType.TOUCH_END, this.onHeroYar, this)
        this.develop.on(Node.EventType.TOUCH_END, this.onDevelop, this)
        this.transport.on(Node.EventType.TOUCH_END, this.onTransport, this)
        this.army.on(Node.EventType.TOUCH_END, this.onArmy, this)
        this.palace.on(Node.EventType.TOUCH_END, this.onPalace, this)
        this.report.on(Node.EventType.TOUCH_END, this.onReport, this)
        this.rank.on(Node.EventType.TOUCH_END, this.onRank, this)
        this.union.on(Node.EventType.TOUCH_END, this.onUnion, this)
        this.pass.on(Node.EventType.TOUCH_END, this.onPass, this)
    }

    onDevelop(){
        UIManager.instance.openUI(PrefabEnum.DevelopIndex)
    }

    onTransport(){
        UIManager.instance.openUI(PrefabEnum.Transport)
    }

    onClose(){
        UIManager.instance.closeUI(PrefabEnum.MenuLayout)
    }

    onArmy(){
        UIManager.instance.openUI(PrefabEnum.ArmyIndex)
    }

    onPalace(){
        UIManager.instance.openUI(PrefabEnum.PalaceIndex)
    }

    onReport(){
        UIManager.instance.openUI(PrefabEnum.ReportIndex)
    }

    onRank(){
        
        UIManager.instance.openUI(PrefabEnum.RankIndex)
    }

    onArt(){
        UIManager.instance.tip('敬请期待')
       
    }
    onCopy(){
        UIManager.instance.tip('敬请期待')
    }
    onHeroFight(){
        UIManager.instance.openUI(PrefabEnum.HeroYard)
    }
    onHeroYar(){
        UIManager.instance.openUI(PrefabEnum.HeroYard)
    }

    onUnion(){
        UIManager.instance.openUI(PrefabEnum.AllyIndex)
    }
    onPass(){
        UIManager.instance.tip('敬请期待')
    }
}


